package ch.esn.server.converter;

import java.util.HashMap;
import java.util.Map;

import ch.esn.shared.gxt.model.UserModel;

import com.google.appengine.api.users.User;

public final class UserConverter implements EntityToModelConverter<User, UserModel> {

	private static final UserConverter instance = new UserConverter();

	public static UserConverter getInstance() {
		return instance;
	}

	private UserConverter() {

	}

	public UserModel getModel(User entity) {
		Map<String, Object> properties = new HashMap<String, Object>();
		properties.put("authDomain", entity.getAuthDomain());
		properties.put("email", entity.getEmail());
		properties.put("nickname", entity.getNickname());
		properties.put("userId", entity.getUserId());

		return new UserModel(properties);
	}

}
